//
// Created by zhp on 2025/7/22.
//
#include <iostream>
using namespace std;

class Stu {
public:
    int age;
    Stu(const int &a):age(a){};
};

class Stu2 {
public:
    const int &age;
    Stu2(const int &a):age(a){};
};

const string& a(){};
// 错误，语法错误
// const &string b(){};

int main() {
    int a = 1;
    Stu *stu = new Stu(a);
    Stu2 *stu2 = new Stu2(a);
    // 改变指针指向地址的数值
    size_t *x = (size_t*)&a;
    *x = 2;
    // 打印
    cout << a << endl;
    cout << "stu.age:" << stu->age<< endl;
    cout << "stu2.age:" << stu2->age<< endl;


    Stu *s = new Stu(a);
    // Stu&
    const Stu &b = *s;
    // &stu
    const Stu *ptr = &b;
}
